import {fileURLToPath, URL} from 'node:url'

import {defineConfig, loadEnv} from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'

// https://vitejs.dev/config/
export default ({mode}:any) => {
  console.log('loadEnv:', mode)
  console.log('loadEnv:', loadEnv(mode, process.cwd()))
  return defineConfig({
    plugins: [vue(), vueJsx()],
    // server: {
    //   //dev
    //   proxy: {
    //     '/api': {
    //       target: "https://wms.api.goexc.cn:20000",
    //       rewrite: (path) => path.replace(/^\/api/, '')
    //     }
    //   }
    // },
    resolve: {
      alias: {
        '@': fileURLToPath(new URL('./src', import.meta.url))
      }
    },
    build: {
      chunkSizeWarningLimit: 1600,
    },
  })
}

